/*
 * This file is part of the GUI_SDK.
 *
 * Copyright (c) 2019-2019 Link-Card Co.,Ltd. All rights reserved.
 *
 * Authors:
 *    JiangYong <1556631285@qq.com>
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * 'Software'), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 * Function:  header file
 * Created on: 2019-10-05
 */

#ifndef  __v4l2overlay_t_
#define  __v4l2overlay_t_


void SDL_v4l2_driver_init(void * phandle);
void SDL_v4l2_RenderMemory(void * phandle, unsigned int  currentBufIdx);

/**************************************************************
*
*   SDL_v4l2_RenderMem_Pull
*   切换显存空间
*/
int SDL_v4l2_RenderMem_Pull(void * phandle);

/**************************************************************
*
*   SDL_v4l2_RenderMem_Push
*   刷新显存空间
*/
int SDL_v4l2_RenderMem_Push(void * phandle);

void SDL_v4l2_RenderPresent(void * phandle);
void SDL_v4l2_driver_deinit(void);
void SDL_v4l2_start(void);
void SDL_v4l2_stop(void);

/*******************************************************************
*
*
*******************************************************************/
void*  start_disp(void *windows,int layer, int dispx, int dispy,int dispw, int disph);


/*******************************************************************
*
*
*******************************************************************/
int   stop_disp(void ** pphandle);


/*******************************************************************
*
*
*******************************************************************/
int   pause_disp(void * phandle);


/*******************************************************************
*
*
*******************************************************************/
int   resume_disp(void * phandle);


typedef enum
{
	GUI_BLOCK_LEFTUP = 0,
	GUI_BLOCK_RIGHTUP,
	GUI_BLOCK_LEFTDOWN,
	GUI_BLOCK_RIGHTDOWN,
	GUI_BLOCK_CENTER,
	GUI_BLOCK_MAXS,
}eGUI_BLOCK_ID;


typedef enum
{
	GUI_CANVAS_ALL = 0,  //handle by IFP process
	GUI_CANVAS_RECORD,   //handle by (0,0)
	GUI_CANVAS_LCD,      //handle by (0,1)
	GUI_CANVAS_MAXS,
}eGUI_CANVAS_ID;


/****************************************************
* 1. Set Videogui env
*
* SDL_v4l2_Vidgui_SetEnv
*   dwalphabits: (2)
*   dwalphalevel: (0-3)
*   eCanvasId: (0-2)
*   dwColormode: (0-1)  videogui
*
*/
int SDL_v4l2_Vidgui_SetEnv(unsigned  int dwalphabits,
							unsigned int dwalphalevel,
							unsigned int eCanvasId,
							unsigned int dwColormode);


/****************************************************
* 2. init videogui blocks
*
*
* SDL_v4l2_Vidgui_InitGUIBlk
*   blkid: (0 --4)
*   dwPosx:
*   dwPosY:
*   dwWidth:
*   dwHeight:
*/
int SDL_v4l2_Vidgui_InitGUIBlk(void * phandle,
							unsigned int blkid,
							unsigned int dwPosx,
							unsigned int dwPosY,
							unsigned int dwWidth,
							unsigned int dwHeight);


/****************************************************
* 4. deinit videogui blocks
*
* SDL_v4l2_Vidgui_DeinitBlks
*   blkid: (0 --4)
*/
int SDL_v4l2_Vidgui_DeinitGUIBlk(void * phandle,unsigned int blkid);



/*****************************************************
*  SDL_v4l2_Vidgui_Render2GUIBlk
*
*   intput:
*   phandle: SDL_Surface point
*   blkid:  (0 --4)
*   onoff:  render this surface or not
*
*/
void SDL_v4l2_Vidgui_Render2GUIBlk(void * phandle, unsigned int blkid, unsigned int onoff);


#endif